home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / win-fort.zip / DRAWHOUR.FOR < prev    next >
Text File  |  1991-11-09  |  3KB  |  75 lines

  1. $DEFINE GDI
  2. $DEFINE USER
  3.       INCLUDE 'WINDOWS.FI'
  4.       SUBROUTINE DRAW_HOURHAND
  5.       IMPLICIT NONE
  6. C
  7. C Author       : Kevin B Black
  8. C Date written : 23-Oct-1991
  9. C Abstract     :
  10. C
  11. C DRAW HOUR HAND
  12. C
  13. C Draws minute hand using the colour specified by the COLOUR argument. Only a
  14. C line is drawn in the iconic state, using the second hand's vectors. If solid
  15. C hands are required, in the non-iconic state, then the hands area is flood
  16. C filled with the Polygon function.
  17. C
  18. C Variables
  19. C
  20.       REAL HHAND(2,8)              ! Hour hand vector description
  21.       REAL COSA,SINA,HANGLE        ! Cosine, Sine and Hour Hand angle
  22.       INTEGER I                    ! Work integer
  23.       INCLUDE 'WINDOWS.FD'         ! Windows functions and parameters
  24.       RECORD /POINT/ HHANDV(8)     ! Hour hand device vectors
  25.       INCLUDE 'FWCLOCK.FD'         ! Include FWLCOCK variables and parameters
  26.       DATA HHAND/-0.03, 0.00,      ! Hour hand outline vectors
  27.      *           -0.04, 0.30,
  28.      *           -0.05, 0.425,
  29.      *            0.00, 0.50,
  30.      *            0.05, 0.425,
  31.      *            0.04, 0.30,
  32.      *            0.03, 0.00,
  33.      *           -0.03, 0.00/
  34. C
  35. C Compute hour angle
  36. C
  37.       HANGLE=PI-(FLOAT(OHOURS)+FLOAT(OMINS)/60.0)*5.0*ZINC
  38.       COSA=COS(HANGLE)
  39.       SINA=SIN(HANGLE)
  40. C
  41. C Depends if window is open or iconic
  42. C
  43.       IF(IMANICON)THEN
  44. C
  45. C In the iconic state only a line is required, the pen and ROP2 mode should
  46. C already have been selected.
  47. C
  48.          WSTATUS=MoveTo(FWCPS.HDC,AXC,AYC)
  49.          HHANDV(1).X=AXC+FLOAT(RADIUS)*0.45*SINA
  50.          HHANDV(1).Y=AYC+FLOAT(RADIUS)*0.45*COSA
  51.          WSTATUS=LineTo(FWCPS.HDC,HHANDV(1).X,HHANDV(1).Y)
  52.       ELSE
  53. C
  54. C In the open window state the minute hand outline must be rotated to the
  55. C correct angle. It is then drawn using the Polyline or filled in with the
  56. C Polygon function, if solid hands have been chosen by the user.
  57. C
  58.          DO I=1,8
  59.             HHANDV(I).X=AXC+FLOAT(RADIUS*HHAND(1,I))*COSA+
  60.      *                      FLOAT(RADIUS*HHAND(2,I))*SINA
  61.             HHANDV(I).Y=AYC-FLOAT(RADIUS*HHAND(1,I))*SINA+
  62.      *                      FLOAT(RADIUS*HHAND(2,I))*COSA
  63.          ENDDO
  64.          IF(SOLIDHANDS)THEN
  65.             WSTATUS=Polygon(FWCPS.HDC,HHANDV,8)
  66.          ELSE
  67.             WSTATUS=Polyline(FWCPS.HDC,HHANDV,8)
  68. C            IF(SOLIDHANDS)WSTATUS=FloodFill(FWCPS.HDC,
  69. C     *                               AXC+FLOAT(RADIUS)*0.45*SINA,
  70. C     *                               AYC+FLOAT(RADIUS)*0.45*COSA,COLOUR)
  71.          ENDIF
  72.       ENDIF
  73.       RETURN
  74.       END
  75.